//
//  SDWebImage_Demo1VC.swift
//  APSwift
//
//  Created by jianbo.pei on 2022/7/14.
//

import UIKit
import SDWebImage

class SDWebImage_Demo1VC: UIViewController {

    private var appleImageView: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        initUI()
    }
    
    

}

extension SDWebImage_Demo1VC {
    func initUI() {
        appleImageView = UIImageView(frame: CGRect(x: 0, y: 120, width: 80, height: 80))
        view.addSubview(appleImageView)
        let resizingTransformer = SDImageResizingTransformer(size: CGSize(width: 80, height: 80), scaleMode: .aspectFill)
        let url = URL(string: "https://img2.baidu.com/it/u=2440426478,79072630&fm=253&fmt=auto&app=138&f=JPEG?w=567&h=490")
        appleImageView.sd_setImage(with: url, placeholderImage: nil, context: [SDWebImageContextOption.imageTransformer: resizingTransformer])
    }
}
